<!--
 * @Author: g05047
 * @Date: 2021-06-03 15:30:58
 * @LastEditors: Please set LastEditors
 * @LastEditTime: 2021-07-19 15:56:35
 * @Description: file content
-->
<template>
  <a-modal class="modal-table" title="同步记录" :visible="visible" :width="560" :footer="false" :dialog-style="{ top: '200px' }" @cancel="handleCancel">
    <a-table rowKey="id" :columns="columns" :data-source="dataSource" :pagination="false" style="background: #fff">
      <a-badge slot="status" slot-scope="text" v-if="text" :color="text? 'green' : 'red'" :text="text?'成功':'失败'" />
    </a-table>
  </a-modal>
</template>

<script>
import { getSearchUser } from '@/services/project';
export default {
  name: 'infoRecord',
  props: {
    visible: {
      type: Boolean,
      default: false
    }
  },
  data () {
    return {
      columns: [
        {
          title: '日期',
          dataIndex: 'name',
        },
        {
          title: '操作',
          dataIndex: 'age',
        },
        {
          title: '操作状态',
          dataIndex: 'status',
          scopedSlots: { customRender: 'status' },
        },
      ],
      dataSource: [
        {
          name: 1,
          age: 2,
          status: true
        },
        {
          name: 1,
          age: 2,
          status: false
        },
        {
          name: 1,
          age: 2,
          status: false
        },
        {
          name: 1,
          age: 2,
          status: false
        },
        {
          name: 1,
          age: 2,
          status: false
        },
        {
          name: 1,
          age: 2,
          status: false
        },
        {
          name: 1,
          age: 2,
          status: false
        },
        {
          name: 1,
          age: 2,
          status: false
        },
        {
          name: 1,
          age: 2,
          status: false
        },
        {
          name: 1,
          age: 2,
          status: false
        },
        {
          name: 1,
          age: 2,
          status: false
        },
        {
          name: 1,
          age: 2,
          status: false
        },
        {
          name: 1,
          age: 2,
          status: false
        },
        {
          name: 1,
          age: 2,
          status: false
        },
        {
          name: 1,
          age: 2,
          status: false
        },
        {
          name: 1,
          age: 2,
          status: false
        },
        {
          name: 1,
          age: 2,
          status: false
        }
      ]
    };
  },
  methods: {
    handleCancel () {
      this.$emit('cancelModal');
    },
    onSearchUser (value) {
      if (value.length >= 2) {
        this.getSearchUser({ realName: value });
      }
    },
    onChangeUser (value) {
      const arr = value.split(',');
      this.formState.creator = arr[0]
    },
    /**
     * @description: 搜索系统人员
     * @param {*}
     * @return {*}
     */
    getSearchUser (params) {
      getSearchUser(params).then(res => {
        let { code, data, msg } = res.data;
        if (code == 200) {
          this.memberList = data;
        } else {
          this.$message.error(msg);
        }
      });
    },
  },
};
</script>

<style lang="less" scoped>
.modal-table {
  /deep/.ant-modal-body {
    max-height: 445px;
    overflow-y: auto;
  }
}
</style>
